package com.bf.electroplating.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bf.electroplating.pojo.dto.IdDTO;
import com.bf.electroplating.pojo.dto.standardspecification.ParkStandardSpecificationQueryDTO;
import com.bf.electroplating.pojo.vo.ResultVO;
import com.bf.electroplating.pojo.vo.standardspecification.ParkStandardSpecificationVO;
import com.bf.electroplating.service.ParkStandardSpecificationService;
import com.bf.electroplating.util.idempotent.Idempotent;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Tag (name = "标准规范")
@RestController
@RequestMapping ("/parkStandardSpecification")
public class ParkStandardSpecificationController {
    @Autowired
    private ParkStandardSpecificationService parkStandardSpecificationService;


    @PostMapping ( "/pageList" )
    @Operation ( summary = "分页查询", description = "分页查询" )
    public ResultVO < Page < ParkStandardSpecificationVO > > pageList ( @RequestBody ParkStandardSpecificationQueryDTO queryDTO ) {
        return parkStandardSpecificationService.pageList ( queryDTO );
    }


    @Idempotent
    @PostMapping ( "/saveData" )
    @Operation ( summary = "新增", description = "新增" )
    public ResultVO < String > saveData ( @RequestBody @Validated ParkStandardSpecificationVO dto ) {
        return parkStandardSpecificationService.saveData ( dto );
    }

    @PostMapping ( "/delete" )
    @Operation ( summary = "删除", description = "删除" )
    public ResultVO < String > delete ( @RequestBody List < String > ids ) {
        return parkStandardSpecificationService.delete ( ids );
    }

    @PostMapping ( "/detail" )
    @Operation ( summary = "获取详情", description = "获取详情" )
    public ResultVO < ParkStandardSpecificationVO > getDetail ( @RequestBody IdDTO  idDTO  ) {
        return parkStandardSpecificationService.getDetail ( idDTO.getId () );
    }
    
}
